package com.ijiuchuang.jc_localization.network;

import com.ijiuchuang.jc_localization.network.api.ApiStore;
import com.ijiuchuang.jc_localization.network.api.BmobApi;
import com.ijiuchuang.jc_localization.network.api.ShowApi;

import retrofit2.Retrofit;

/**
 * Created by 王伟 on 2016/6/7
 * Function :
 */
public class ApiModel {

    public static ApiStore apiStore() {
        Retrofit retrofit = new Retrofit.Builder()
                .client(Client.apiStoreClient())
                .baseUrl(URL.apiStoreURL)
                .addConverterFactory(Factory.gsonConverterFactory)
                .addCallAdapterFactory(Factory.rxJavaCallAdapterFactory)
                .build();
        ApiStore apiStore = retrofit.create(ApiStore.class);

        return apiStore;
    }

    public static ShowApi showApi() {
        Retrofit retrofit = new Retrofit.Builder()
                .client(Client.defaultHttpClient)
                .baseUrl(URL.showApiURL)
                .addConverterFactory(Factory.gsonConverterFactory)
                .addCallAdapterFactory(Factory.rxJavaCallAdapterFactory)
                .build();
        ShowApi showApi = retrofit.create(ShowApi.class);

        return showApi;
    }

    public static BmobApi bmobGetApi() {
        Retrofit retrofit = new Retrofit.Builder()
                .client(Client.bmobGetClient())
                .baseUrl(URL.bmobURL)
                .addConverterFactory(Factory.gsonConverterFactory)
                .addCallAdapterFactory(Factory.rxJavaCallAdapterFactory)
                .build();
        BmobApi bmobApi = retrofit.create(BmobApi.class);

        return bmobApi;
    }

    public static BmobApi bmobPostApi() {
        Retrofit retrofit = new Retrofit.Builder()
                .client(Client.bmobPostClient())
                .baseUrl(URL.bmobURL)
                .addConverterFactory(Factory.gsonConverterFactory)
                .addCallAdapterFactory(Factory.rxJavaCallAdapterFactory)
                .build();
        BmobApi bmobApi = retrofit.create(BmobApi.class);

        return bmobApi;
    }
}
